package com.example.base.plugin.moudel;

import com.example.base.app.AppFunction;
import com.example.base.security.domain.SysDept;
import com.example.base.security.service.SysDeptService;
import com.example.base.utils.Result;
import com.example.base.utils.SpringContextUtils;

import java.util.Map;

public class SysDeptPlugin implements AppFunction {
    @Override
    public String getAppFunctionName() {
        return "getSysDeptByDeptId";
    }

    @Override
    public Object appFunction(Map<String, Object> objectMap) {
        if(!objectMap.containsKey("deptId")){
            return Result.errorInfo("部门id不得为空");
        }
        SysDeptService service= SpringContextUtils.getBean(SysDeptService.class);
        SysDept sysDept= service.getById(String.valueOf(objectMap.get("deptId")));
        return Result.successInfo(sysDept);
    }
}
